<h2>Why is this an issue?</h2>
<p>A selector parameter is a <code>boolean</code> parameter that’s used to determine which of two paths to take through a method. Specifying such a
parameter may seem innocuous, particularly if it’s well-named.</p>
<p>Unfortunately, developers calling the method won’t see the parameter name, only its value. They’ll be forced either to guess at the meaning or to
take extra time to look the method up. Additionally, selector parameters create maintenance challenges: adding a third option requires changing the
boolean to an enum or similar type, breaking existing code.</p>
<p>This rule finds methods with a <code>boolean</code> that is used to determine which path to take through the method.</p>
<h3>Noncompliant code example</h3>
<pre>
function feed(name: string, isHuman: boolean) {
  if (isHuman) {
    // implementation for human
  } else {
    // implementation for animal
  }
}

// Intent is not clear at call site
feed('Max', false); // does this mean not to feed Max?
</pre>
<h3>Compliant solution</h3>
<p>Instead, split the method into separate, clearly named methods:</p>
<pre>
function feedHuman(name: string) {
  offerSushi(name);
}

function feedAnimal(name: string) {
  offerCarrot(name);
}

// Clear intent at call site
feedHuman("Joe");
feedAnimal("Max");
</pre>
<p>Alternatively, use descriptive object parameters or types:</p>
<pre>
type EntityType = 'human' | 'animal';

function feed(name: string, entityType: EntityType) {
  if (entityType === 'human') {
    // implementation for human
  } else {
    // implementation for animal
  }
}

feed('Max', 'animal');
</pre>
<pre>
function feed(name: string, { human = true } ) {
  if (human) {
    // implementation for human
  } else {
    // implementation for animal
  }
}

feed('Max', { human: false });
</pre>
